<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/common.jspf" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>

</head>
<script type="application/javascript">

    $(document).ready(function(){
        var win = parent.$("iframe[title='订单管理']").get(0).contentWindow;
        var row = win.$("#dg").datagrid("getSelected");
        // var row1 = win.$("#detail").datagrid("getSelected");
        // alert(row1.goodName);
        $("#store").val(row.conpanyId);
        $("#deskid").val(row.deskId);
        $("#deskname").val(row.deskName);
        $("#ordernum").val(row.orderNum);
        $("#pay").val(row.orderTruepay);
        /* var deskid = row.deskId;
         alert(deskid)*/

        $('#bb').datagrid({
            url:"${proPath}/order/zhengjieshow.action",
            queryParams: {
                deskid: row.deskId
            },

            columns:[[
                {checkbox: true},
                {field:'orderNum',title:'订单号',width:100},
                {field:'goodNum',title:'商品编号',width:100},
                {field:'goodName',title:'商品名字',width:100},
                {field:'goodExitNum',title:'商品数量',width:100},
                {field:'goodTotalPrice',title:'总价格',width:100},
                {field:'orderState',title:'菜品状态',width:100},
                {field:'payForm',title:'付款形式',width:100},
                {field:'orderMessage',title:'备注',width:100,align:'right'}
            ]],
            striped:true,
            rownumbers:true,
            pagination:true,
            pageSize:2,
            pageList:[1,2,3,4,5]
        });

    });

    function fan() {
        //关闭窗口
        parent.$('#win').window('close');
    };


    function jie() {
        //获取父页面相关信息 获取订单号
        var win = parent.$("iframe[title='订单管理']").get(0).contentWindow;
        var row = win.$("#dg").datagrid("getSelected");
        // var deskid = row.deskid;
        //alert1(deskid)
        //判断订单状态 1代表未付款
        alert(row.orderNum);

        //判断所有菜品状态 4代表上菜了

        //修改订单状态
        $.post(
            "${proPath}/order/zheng.action",
            {simpleOrder:row.orderNum,

            },
            function (data) {
                alert("结款成功")
                //修改餐桌状态
                $.ajax({
                    type: "post",
                    url:"${proPath}/storetable/updateAble.action",
                    data:{tableId: row.deskId},
                    dataType: "json",
                    success: function (data) {

                    }
                })

                parent.$('#win').window('close');
                win.$("#dg").datagrid("reload");
            },
            "json"
        )
    };




</script>

<body>


公司名字：<input id="store" type="text" class="easyui-validatebox">
餐桌号:<input id="deskid" type="text" value="" class="easyui-validatebox">
餐桌名字:<input id="deskname" type="text" value="" class="easyui-validatebox"><br>
订单号:<input id="ordernum" type="text" value="" class="easyui-validatebox">
付款金额:<input id="pay" type="text" value="" class="easyui-validatebox">
付款方式：<select id="bm" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">微信</option>
    <option>支付宝</option>
    <option>现金</option>

</select>

<div class="easyui-panel" title="结算页面">
    <table id="bb"></table>
    <a  href="" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="jie()">结算</a>
    <a   class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="fan()">返回</a><br>
</div>
<input type="button" onclick="ad()">

</body>
<script>


</script>
</html>
